package arrayandlinkedlist

func twoSum(nums []int, target int) []int {
	hashMap := map[int]int{}
	for i, v := range nums {
		if j, ok := hashMap[target-v]; ok {
			return []int{j, i}
		}
		hashMap[v] = i
	}
	return nil
}
